package projetolp2.GraphicInterface;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Sugestoes extends MealPoints implements ActionListener{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel panel1 = new JPanel(new GridLayout(0, 1));
	private JPanel panel2= new JPanel(new GridLayout(0, 1));
	private JPanel panel3= new JPanel(new GridLayout(0, 1));
	private JPanel panel4= new JPanel(new GridLayout(0, 1));
	private JPanel panelMenu = new JPanel(new BorderLayout());
	private JButton PERSONALIZADA = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getPersonalizada());
	private JButton GENERICA = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getGenerica());
	private JButton VOLTAR = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getVoltar());
	final JLabel label = new JLabel("Escolha o tipo sugestao: ");
	private JPanel panelFinal = new JPanel();
	
	public Sugestoes(){
		
	}private void ajudaDeBotoes(){
		PERSONALIZADA.setToolTipText("Sugestoes dada a partir do tipo de servi�o desejado");
		GENERICA.setToolTipText("Sugestoes dada a partir dos estabelecimentos com melhores notas");
		VOLTAR.setToolTipText("Voltar a janela anterior");
	}
	
	@SuppressWarnings("deprecation")
	public void actionPerformed(ActionEvent e){
		if(e.getSource() == PERSONALIZADA){
			removerAdicionar(sugestoes,sugestoespersonalizadas );
		}
		else if(e.getSource() == GENERICA){
			janela.disable();
			quantidadeSugestoes.abilitaDesabilita(true, "generica");
		}
		else if(e.getSource() == VOLTAR){
			removerAdicionar(sugestoes,menu );
			
		}
	}
	private void createComponents() {
		ajudaDeBotoes();
		
		PERSONALIZADA.setMnemonic(KeyEvent.VK_I);
		PERSONALIZADA.addActionListener(this);
        label.setLabelFor(PERSONALIZADA);
        
        GENERICA.setMnemonic(KeyEvent.VK_I);
        GENERICA.addActionListener(this);
        label.setLabelFor(GENERICA);
        
        VOLTAR.setMnemonic(KeyEvent.VK_I);
        VOLTAR.addActionListener(this);
        label.setLabelFor(VOLTAR);
        
        panel1.add(label);
        panel2.add(PERSONALIZADA);
        panel3.add(GENERICA);
        panel4.add(VOLTAR);
        
        panel1.setBorder(BorderFactory.createEmptyBorder(
        		5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel2.setBorder(BorderFactory.createEmptyBorder(
        		5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel3.setBorder(BorderFactory.createEmptyBorder(
        		5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel4.setBorder(BorderFactory.createEmptyBorder(
        		5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panelFinal.add(panel1);
        panelFinal.add(panel2);
        panelFinal.add(panel3);
        panelFinal.add(panel4);
        panelMenu.add(panelFinal,BorderLayout.NORTH);
    }
	public Component panel(){
		createComponents();
		panelMenu.setBackground(Color.white);
		panelMenu.setVisible(true);
		
		
		return panelMenu;
	}	
}